//
//  CZChatCell.m
//  XMPP项目练习
//
//  Created by 盛 发 况 on 16/5/6.
//  Copyright © 2016年 盛 发 况. All rights reserved.
//

#import "CZChatCell.h"
#import "CZRecorder.h"

@implementation CZChatCell

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {

    // 如果有音频数据，直接播放音频
    if (self.audioData != nil) {
        self.messageLabel.textColor = [UIColor redColor];
        
        // 如果单例的块代码中包含self，一定使用weakSelf
        __weak CZChatCell *weakSelf = self;
        [[CZRecorder sharedRecorder] playData:self.audioData completion:^{
            weakSelf.messageLabel.textColor = [UIColor blackColor];
        }];
    }

}


@end
